package week04;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class PersonOverride{
	private String name;
	private int age;
	private boolean gender;
	public PersonOverride() {
		this("default", 1, true);
	}
	public PersonOverride(String name, int age, boolean gender) {
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	@Override
	public String toString() {
		return name+"-"+age+"-"+gender;
	}

	public boolean equals(java.lang.Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonOverride other = (PersonOverride) obj;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	

	
}

public class Mainfugai {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n1=Integer.parseInt(in.nextLine());
		PersonOverride []person1=new PersonOverride[n1];
		for(int i=0;i<person1.length;i++)
			person1[i]=new PersonOverride();
		int n2=Integer.parseInt(in.nextLine());
		ArrayList<PersonOverride> person2=new ArrayList<PersonOverride>();
		for(int i=0;i<n2;i++) {
			PersonOverride peri=new PersonOverride(in.next(),in.nextInt(),in.nextBoolean());
			if(!person2.contains(peri))
				person2.add(peri);
		}
		for(int i=0;i<n1;i++)
			System.out.println(person1[i]);
		for(int i=0;i<person2.size();i++)
			System.out.println(person2.get(i));
		System.out.println(person2.size());
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	}

}
